<div class="full_w">
    <div class="h_title"><?php echo Yii::t('AdmincpModule.admincp', 'Update Campaign'); ?></div>
    <?php 
        foreach(Yii::app()->admin->getFlashes() as $key => $message){
            echo '<div class="n_'.$key.'"><p>'.$message."</p></div>\n";
        }
    ?>
    <form action="" method="post" id="frm">
    	<div class="element">
            <label>Name <span class="red">*</span></label>
            <input type="text" name="campaign[campaign_name]" id="campaign_name" class="text required" value="<?php echo isset($arrItemInfo['campaign_name'])?$arrItemInfo['campaign_name']:null; ?>" autocomplete="off">
        </div> 
        <div class="element">
            <label>Description</label>
            <textarea name="campaign[campaign_description]" id="campaign_description" class="textarea" ><?php echo isset($arrItemInfo['campaign_description'])?$arrItemInfo['campaign_description']:null; ?></textarea>
        </div>   
        <div class="element">
            <label>Published Date</label>
            <input type="text" name="campaign[campaign_published_date]" id="published" value="<?php echo isset($arrItemInfo['campaign_published_date'])?$arrItemInfo['campaign_published_date']:null; ?>" autocomplete="off">
        	<p class="description">(dd-mm-yyyy) GMT+7 | Leave it blank means published now</p>
        </div>  
        <div class="element">
            <label>Expiry Date</label>
            <input type="text" name="campaign[campaign_expiry_date]" id="expiry" value="<?php echo isset($arrItemInfo['campaign_expiry_date'])?$arrItemInfo['campaign_expiry_date']:null; ?>" autocomplete="off">
        	<p class="description">(dd-mm-yyyy) GMT+7 | Leave it blank means never expired</p>
        </div>   
        <div class="element">
            <label>Status</label>
            <select name="campaign[campaign_status]" id="campaign_status">
            	<option value="0">Inactive</option>
                <option value="1" <?php if(isset($arrItemInfo['campaign_status']) && $arrItemInfo['campaign_status'] == '1'): ?>selected<?php endif; ?>>Active</option>
            </select>
        </div>     
        <div class="entry">
        	<input type="hidden" name="campaign[client_id]" id="client_id" value="<?php echo isset($arrItemInfo['client_id'])?$arrItemInfo['client_id']:$intClient; ?>">
            <input type="hidden" name="id" id="id" value="<?php echo isset($arrItemInfo['campaign_id'])?$arrItemInfo['campaign_id']:null; ?>">
            <button type="submit">Submit</button> 
            <button type="button" onClick="window.location='<?php echo LINK_ADMINCP_ADVERTISEMENTS; ?>'">Cancel</button>
        </div>
    </form>
</div>
<script type="text/javascript">
	$(function(){
	$("#published").datepicker({
		dateFormat:'dd-mm-yy',
		minDate: '0',
		changeMonth: true,
		changeYear: true,
		onClose: function( selectedDate ) {
			if(selectedDate != ''){
				$("#expiry").datepicker( "option", "minDate", selectedDate );
			}
		}
	});
	$("#expiry").datepicker({
		dateFormat:'dd-mm-yy',
		timeFormat: 'hh:mm',
		minDate: '0',
		changeMonth: true,
		changeYear: true,
		onClose: function( selectedDate ) {
			if(selectedDate != ''){
				$("#published").datepicker( "option", "maxDate", selectedDate );
			}
		}
	});
	$('#frm').validate();
});
</script>
